package com.example.administrator.jingpingou.bean;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import org.json.JSONException;
import org.json.JSONObject;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by 小吧 on 2016/8/30.
 */
public class ShopTitleBean {
    /**
     * ipadimg : http://image.repaiapp.com/spzt/images/list/ipad_1472464863/
     * iphoneimg : http://image.repaiapp.com/spzt/images/list/iphone_1472464863/
     * iphonezimg : http://image.repaiapp.com/spzt/images/list/iphonez_1472464863/
     * ipadzimg : http://image.repaiapp.com/spzt/images/list/ipadz_1472464863/
     * iphonemimg : http://image.repaiapp.com/spzt/images/list/iphonem_1472464863/
     * iphoneimgnew : http://image.repaiapp.com/spzt/images/list/iphoneimgnew_1472464863/
     * iphonehomebig : http://image.repaiapp.com/spzt/images/list/iphonehomebig_1472464863/
     * title : 居家生活篇
     * rgb : #ebd257
     * target : push
     * linktype : num_iid
     * link : http://app.api.repai.com/wotaotao/web/new_spzt.php?topic_id=9&spzt_id=956&app_id=1&app_oid=201A0626625F0000&app_version=1.0&app_channel=91com&sche=pashley&target=push&
     */

    private List<DataYan> data;

    public static ShopTitleBean objectFromData(String str) {

        return new Gson().fromJson(str, ShopTitleBean.class);
    }

    public static ShopTitleBean objectFromData(String str, String key) {

        try {
            JSONObject jsonObject = new JSONObject(str);

            return new Gson().fromJson(jsonObject.getString(str), ShopTitleBean.class);
        } catch (JSONException e) {
            e.printStackTrace();
        }

        return null;
    }

    public static List<ShopTitleBean> arrayShopTitleBeanFromData(String str) {

        Type listType = new TypeToken<ArrayList<ShopTitleBean>>() {
        }.getType();

        return new Gson().fromJson(str, listType);
    }

    public static List<ShopTitleBean> arrayShopTitleBeanFromData(String str, String key) {

        try {
            JSONObject jsonObject = new JSONObject(str);
            Type listType = new TypeToken<ArrayList<ShopTitleBean>>() {
            }.getType();

            return new Gson().fromJson(jsonObject.getString(str), listType);

        } catch (JSONException e) {
            e.printStackTrace();
        }

        return new ArrayList();


    }

    public List<DataYan> getData() {
        return data;
    }

    public void setData(List<DataYan> data) {
        this.data = data;
    }

    public static class DataYan {
        private String ipadimg;
        private String iphoneimg;
        private String iphonezimg;
        private String ipadzimg;
        private String iphonemimg;
        private String iphoneimgnew;
        private String iphonehomebig;
        private String title;
        private String rgb;
        private String target;
        private String linktype;
        private String link;

        public static DataYan objectFromData(String str) {

            return new Gson().fromJson(str, DataYan.class);
        }

        public static DataYan objectFromData(String str, String key) {

            try {
                JSONObject jsonObject = new JSONObject(str);

                return new Gson().fromJson(jsonObject.getString(str), DataYan.class);
            } catch (JSONException e) {
                e.printStackTrace();
            }

            return null;
        }

        public static List<DataYan> arrayDataYanFromData(String str) {

            Type listType = new TypeToken<ArrayList<DataYan>>() {
            }.getType();

            return new Gson().fromJson(str, listType);
        }

        public static List<DataYan> arrayDataYanFromData(String str, String key) {

            try {
                JSONObject jsonObject = new JSONObject(str);
                Type listType = new TypeToken<ArrayList<DataYan>>() {
                }.getType();

                return new Gson().fromJson(jsonObject.getString(str), listType);

            } catch (JSONException e) {
                e.printStackTrace();
            }

            return new ArrayList();


        }

        public String getIpadimg() {
            return ipadimg;
        }

        public void setIpadimg(String ipadimg) {
            this.ipadimg = ipadimg;
        }

        public String getIphoneimg() {
            return iphoneimg;
        }

        public void setIphoneimg(String iphoneimg) {
            this.iphoneimg = iphoneimg;
        }

        public String getIphonezimg() {
            return iphonezimg;
        }

        public void setIphonezimg(String iphonezimg) {
            this.iphonezimg = iphonezimg;
        }

        public String getIpadzimg() {
            return ipadzimg;
        }

        public void setIpadzimg(String ipadzimg) {
            this.ipadzimg = ipadzimg;
        }

        public String getIphonemimg() {
            return iphonemimg;
        }

        public void setIphonemimg(String iphonemimg) {
            this.iphonemimg = iphonemimg;
        }

        public String getIphoneimgnew() {
            return iphoneimgnew;
        }

        public void setIphoneimgnew(String iphoneimgnew) {
            this.iphoneimgnew = iphoneimgnew;
        }

        public String getIphonehomebig() {
            return iphonehomebig;
        }

        public void setIphonehomebig(String iphonehomebig) {
            this.iphonehomebig = iphonehomebig;
        }

        public String getTitle() {
            return title;
        }

        public void setTitle(String title) {
            this.title = title;
        }

        public String getRgb() {
            return rgb;
        }

        public void setRgb(String rgb) {
            this.rgb = rgb;
        }

        public String getTarget() {
            return target;
        }

        public void setTarget(String target) {
            this.target = target;
        }

        public String getLinktype() {
            return linktype;
        }

        public void setLinktype(String linktype) {
            this.linktype = linktype;
        }

        public String getLink() {
            return link;
        }

        public void setLink(String link) {
            this.link = link;
        }
    }
}
